This folder includes data and code necessary to replicate the figures and tables in: 

Christopher Claassen and Pedro C. Magalhães, "Public Support for Democracy in the United States Has Declined Generationally", forthcoming in Public Opinion Quarterly

The following files are included:


lapop_us_democ.csv: Support for democracy measures and demographics from the US AmericasBarometer samples
wvs_us_democ.csv: Support for democracy measures and demographics from the US WVS samples
state_codes.csv: State code / names lookup
mood_est_v5.csv: Claassen's democratic mood dataset, as at 12/2022
POQ US APC extract survey data.R: R code to extract the first two datasets (not required)
POQ US APC support democ.R: R code to run the analyses presented in the paper and SI


The analyses was run in the following environment: 

> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8    LC_MONETARY=English_United Kingdom.utf8
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] bayesplot_1.9.0    RColorBrewer_1.1-3 viridis_0.6.2      viridisLite_0.4.0  brms_2.17.0        Rcpp_1.0.9        
 [7] arm_1.12-2         lme4_1.1-29        Matrix_1.4-1       MASS_7.3-57       

loaded via a namespace (and not attached):
 [1] nlme_3.1-157         matrixStats_0.62.0   xts_0.12.1           threejs_0.3.3        rstan_2.21.5        
 [6] tensorA_0.36.2       tools_4.2.1          backports_1.4.1      utf8_1.2.2           R6_2.5.1            
[11] DT_0.23              DBI_1.1.2            colorspace_2.0-3     tidyselect_1.1.2     gridExtra_2.3       
[16] prettyunits_1.1.1    mnormt_2.0.2         processx_3.5.3       Brobdingnag_1.2-7    compiler_4.2.1      
[21] cli_3.3.0            shinyjs_2.1.0        colourpicker_1.1.1   posterior_1.2.1      scales_1.2.0        
[26] dygraphs_1.1.1.6     checkmate_2.1.0      mvtnorm_1.1-3        psych_2.2.5          ggridges_0.5.3      
[31] callr_3.7.0          stringr_1.4.0        digest_0.6.29        StanHeaders_2.21.0-7 minqa_1.2.4         
[36] base64enc_0.1-3      pkgconfig_2.0.3      htmltools_0.5.2      fastmap_1.1.0        htmlwidgets_1.5.4   
[41] rlang_1.0.2          rstudioapi_0.13      shiny_1.7.1          farver_2.1.0         generics_0.1.2      
[46] zoo_1.8-10           crosstalk_1.2.0      gtools_3.9.2.1       dplyr_1.0.9          distributional_0.3.0
[51] inline_0.3.19        magrittr_2.0.3       loo_2.5.1            munsell_0.5.0        fansi_1.0.3         
[56] abind_1.4-5          lifecycle_1.0.1      stringi_1.7.6        pkgbuild_1.3.1       plyr_1.8.7          
[61] grid_4.2.1           parallel_4.2.1       promises_1.2.0.1     crayon_1.5.1         miniUI_0.1.1.1      
[66] lattice_0.20-45      splines_4.2.1        tmvnsim_1.0-2        knitr_1.39           ps_1.7.0            
[71] pillar_1.7.0         igraph_1.3.1         boot_1.3-28          markdown_1.1         shinystan_2.6.0     
[76] reshape2_1.4.4       codetools_0.2-18     stats4_4.2.1         rstantools_2.2.0     glue_1.6.2          
[81] RcppParallel_5.1.5   nloptr_2.0.2         vctrs_0.4.1          httpuv_1.6.5         gtable_0.3.0        
[86] purrr_0.3.4          assertthat_0.2.1     ggplot2_3.3.6        xfun_0.31            mime_0.12           
[91] xtable_1.8-4         coda_0.19-4          later_1.3.0          tibble_3.1.7         shinythemes_1.2.0   
[96] ellipsis_0.3.2       cmdstanr_0.5.2       bridgesampling_1.1-2